package com.ep.redis;

import java.util.ArrayList;
import java.util.List;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisShardInfo;

public class TestRedis {
	public static void main(String[] args) {
		Jedis jedis=new Jedis("localhost");
		JedisShardInfo jsi=new JedisShardInfo("192.168.1.103");
//		jsi.setPassword("foobared");
		Jedis linuxJedis=new Jedis(jsi);
		System.out.println("linuxJedis:"+linuxJedis.ping());
		System.out.println(jedis.ping());
		System.out.println("get:"+jedis.get("w3c"));
//		System.out.println("lrang:"+jedis.lrange("soeasy", 0, 10));
//		jedis.lpush("soeasy","sosoeasysosoeasy");
//		jedis.lpush("soeasy","sosoeasysosoeasysosoeasysosoeasy");
//		jedis.lpush("soeasy","sosoeasysosoeasysosoeasysosoeasysosoeasysosoeasy");
//		jedis.lpush("soeasy","sosoeasysosoeasysosoeasysosoeasysosoeasysosoeasysosoeasysosoeasy");
//		jedis.lpush("soeasy","sosoeasysosoeasysosoeasysosoeasysosoeasysosoeasysosoeasysosoeasysosoeasysosoeasy");
		List<String> paperNames=new ArrayList<String>();
		paperNames.add("hebeikejidaxue");
		paperNames.add("hashMaps");
		paperNames.add("hashTables");
		for(String paperName:paperNames){
			linuxJedis.lpush("paperNames",paperName);
		}
		System.out.println(jedis.lrange("paperNames",0, 10));
	}
}
